package utils;

import java.io.File;
import java.io.IOException;

public class SystemUtils {
	
	private SystemUtils() {}
	
	public static void openFile(File file) throws IOException {
		 // get os type
		String os = System.getProperty("os.name");
		if (os.contains("Windows")) {
			Runtime.getRuntime().exec("cmd /c start " + file.getAbsolutePath());
		} else if (os.contains("Mac")) {
			Runtime.getRuntime().exec("open " + file.getAbsolutePath());
		} else if (os.contains("Linux")) {
			Runtime.getRuntime().exec("xdg-open " + file.getAbsolutePath());
		}
	}
}
